package client;

import java.util.HashMap;


/*
 * Return type T
 */
public abstract class Command {

	NavigatorContext context;
	
	private String name;

	String arguments;

	public Command(String name) {
		this.name = name;
	}

	public Command() {
		this.name = "unnamed" + getClass().getSimpleName();
	}

	protected abstract void doFunction();
	
	public NavigatorContext getContext() {
		return context;
	}

	public String getName() {
		return name;
	}
	protected String getArguments() {
		return arguments;
	}

	private HashMap<String,Object> parameters = new HashMap<String,Object>();

	
	
	public Object getParameter(String name) {
		return parameters.get(name);
	}
	
	
	public <V> V getParameter(String name, Class<V> V) {
		return (V) getParameter(name);
	}
	public HashMap<String,Object> getParameters() {
		return parameters;
	}
	
	public Command setParameter(String name, Object value) {
		parameters.put(name, value);
		return this;
	}
	
	private HashMap returnMap = new HashMap();
	
	public void ret(String name, Object object) {
		returnMap.put(name, object);
	}
	
	public String[] getRequiredParameterNames() {
		return new String[] { };
	}

	public void resetParameters() {
		this.parameters = new HashMap<String, Object>();
	}

	public HashMap getReturnMap() {
		return returnMap;
	}

}
